/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.auth.manager.impl;

import com.xy.biz.auth.dao.CaptchaDao;
import com.xy.biz.auth.domain.bo.CaptchaBO;
import com.xy.biz.auth.domain.converter.CaptchaConverter;
import com.xy.biz.auth.manager.CaptchaManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * 
 * 
 * @author zsp
 * @date 2020-8-21
 */
@Service
public class CaptchaManagerImpl implements CaptchaManager {

	@Autowired
	private CaptchaDao captchaDao;
	
	@Override
	public int saveCaptcha(CaptchaBO captchaBO) {
		return captchaDao.saveAllCaptcha(Arrays.asList(CaptchaConverter.toPO(captchaBO)));
	}
	
	@Override
	public CaptchaBO getCaptcha(Long captchaId) {
		return CaptchaConverter.fromPO(captchaDao.getCaptcha(captchaId));
	}
	
}
